<?php

/**
 * This is the model class for table "{{exam_notice}}".
 *
 * The followings are the available columns in table '{{exam_notice}}':
 * @property double $notice_id
 * @property double $exam_id
 * @property string $notice_name
 * @property double $notice_status
 * @property double $expired
 * @property string $file
 * @property double $time_created
 * @property double $user_id
 * @property double $create_user
 * @property double $create_time
 * @property double $update_user
 * @property double $update_time
 * @property string $notice_comment
 * @property string $file_name
 */
class ExamNotice extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return ExamNotice the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{exam_notice}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('exam_id, notice_status, expired, time_created, user_id, create_user, create_time, update_user, update_time', 'numerical'),
			array('notice_name', 'length', 'max'=>125),
			array('file', 'length', 'max'=>225),
			array('notice_comment', 'length', 'max'=>4000),
			array('file_name', 'length', 'max'=>1000),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('notice_id, exam_id, notice_name, notice_status, expired, file, time_created, user_id, create_user, create_time, update_user, update_time, notice_comment, file_name', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'notice_id' => 'Notice',
			'exam_id' => 'Exam',
			'notice_name' => 'Notice Name',
			'notice_status' => 'Notice Status',
			'expired' => 'Expired',
			'file' => 'File',
			'time_created' => 'Time Created',
			'user_id' => 'User',
			'create_user' => 'Create User',
			'create_time' => 'Create Time',
			'update_user' => 'Update User',
			'update_time' => 'Update Time',
			'notice_comment' => 'Notice Comment',
			'file_name' => 'File Name',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('notice_id',$this->notice_id);
		$criteria->compare('exam_id',$this->exam_id);
		$criteria->compare('notice_name',$this->notice_name,true);
		$criteria->compare('notice_status',$this->notice_status);
		$criteria->compare('expired',$this->expired);
		$criteria->compare('file',$this->file,true);
		$criteria->compare('time_created',$this->time_created);
		$criteria->compare('user_id',$this->user_id);
		$criteria->compare('create_user',$this->create_user);
		$criteria->compare('create_time',$this->create_time);
		$criteria->compare('update_user',$this->update_user);
		$criteria->compare('update_time',$this->update_time);
		$criteria->compare('notice_comment',$this->notice_comment,true);
		$criteria->compare('file_name',$this->file_name,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}